/***
 * JAVANAISE API
 * Contact: 
 *
 * Authors: 
 */

package jvn.coord.interfaces;

import java.rmi.*;
import java.io.*;

import jvn.client.JvnException;
import jvn.client.interfaces.JvnObjectI;
import jvn.client.interfaces.JvnRemoteServerI;

/**
 * Remote Interface of the JVN Coordinator
 */

public interface JvnRemoteCoordI extends Remote {

	/**
	 * Allocate a NEW JVN object id (usually allocated to a newly created JVN object)
	 * 
	 * @throws java.rmi.RemoteException
	 *             ,JvnException
	 **/
	public int jvnGetObjectId() throws java.rmi.RemoteException, jvn.client.JvnException;

	/**
	 * Associate a symbolic name with a JVN object
	 * 
	 * @param jon
	 *            : the JVN object name
	 * @param jo
	 *            : the JVN object
	 * @param js
	 *            : the remote reference of the JVNServer
	 * @throws java.rmi.RemoteException
	 *             ,JvnException
	 **/
	public void jvnRegisterObject(String jon, JvnObjectI jo, JvnRemoteServerI js) throws java.rmi.RemoteException,
			jvn.client.JvnException;

	/**
	 * Get the reference of a JVN object managed by a given JVN server
	 * 
	 * @param jon
	 *            : the JVN object name
	 * @param js
	 *            : the remote reference of the JVNServer
	 * @throws java.rmi.RemoteException
	 *             ,JvnException
	 **/
	public JvnObjectI jvnLookupObject(String jon, JvnRemoteServerI js) throws java.rmi.RemoteException,
			jvn.client.JvnException;

	/**
	 * Get a Read lock on a JVN object managed by a given JVN server
	 * 
	 * @param joi
	 *            : the JVN object identification
	 * @param js
	 *            : the remote reference of the server
	 * @return the current JVN object state
	 * @throws java.rmi.RemoteException
	 *             , JvnException
	 **/
	public Serializable jvnLockRead(int joi, JvnRemoteServerI js) throws java.rmi.RemoteException, JvnException;

	/**
	 * Get a Write lock on a JVN object managed by a given JVN server
	 * 
	 * @param joi
	 *            : the JVN object identification
	 * @param js
	 *            : the remote reference of the server
	 * @return the current JVN object state
	 * @throws java.rmi.RemoteException
	 *             , JvnException
	 **/
	public Serializable jvnLockWrite(int joi, JvnRemoteServerI js) throws java.rmi.RemoteException, JvnException;

	/**
	 * A JVN server terminates
	 * 
	 * @param js
	 *            : the remote reference of the server
	 * @throws java.rmi.RemoteException
	 *             , JvnException
	 **/
	public void jvnTerminate(JvnRemoteServerI js) throws java.rmi.RemoteException, JvnException;

	/**
	 * Réinitialize le coordinateur dans un état identique a celui dans lequel il est quand il viens d'etre démaré.
	 */
	public void reinitialize() throws java.rmi.RemoteException, JvnException;

}
